package com.ruoyi.zhjd.exp.modules.expcuringroom.service.impl;

import java.util.Map;

import com.ruoyi.zhjd.exp.modules.expcuringroom.entity.ExpCuringRoomEntity;
import com.ruoyi.zhjd.exp.modules.expcuringroom.mapper.ExpCuringRoomMapper;
import com.ruoyi.zhjd.exp.modules.expcuringroom.service.ExpCuringRoomService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;



/**
 * @ClassName: ExpCuringRoomServiceImpl
 * @Description: 养护室业务接口实现
 * @author linhuawei
 * @since 2021-04-20
 */
@Service
public class ExpCuringRoomServiceImpl extends ServiceImpl<ExpCuringRoomMapper, ExpCuringRoomEntity>
        implements ExpCuringRoomService {

//    @Autowired
//    private BaseServiceComponent baseServiceComponent;

    @Override
    public IPage<ExpCuringRoomEntity> page(Map<String, Object> params) {
        // 设置查询条件
        QueryWrapper<ExpCuringRoomEntity> queryWrapper = new QueryWrapper<>();
        if (ObjectUtils.isNotEmpty(params.get("baseName"))) {
            queryWrapper.like("base_name", params.get("baseName"));
        }
        if (null != params.get("startTime")) {
            queryWrapper.ge("DATE_FORMAT(gathering_time,'%Y-%m-%d')", params.get("startTime"));
        }
        if (null != params.get("endTime")) {
            queryWrapper.le("DATE_FORMAT(gathering_time,'%Y-%m-%d')", params.get("endTime"));
        }
        queryWrapper.orderByDesc("gathering_time");

        // 执行查询操作
        IPage<ExpCuringRoomEntity> page = null;
        return baseMapper.selectPage(page, queryWrapper);
    }


}
